package junit;

import java.util.ArrayList;
import java.util.List;

import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

public class UnitTestTest {

	@Test
	public void test01(){
		Assert.assertEquals("should be 3." , 3.33, 10.0/3.0, 0.01);
//		Assert.assertSame(expected, actual);
		Assert.fail("it's fail!");
		
		
		
	}
	
	@Test public void test02(){
		List<String> l = new ArrayList(){{
						add("liu");
						add("jia");
						add("wu");
						add("luo");
						add("he");
						add("guo");
						add("cao");
				}};
		int i = 40;
		for(String a : l){
			String s = "insert into student(name, age, address, tel, score) values ('li', 30, 'li address', 30, 30.1);";
//			System.out.printf("insert into student(name, age, address, tel, score) values ('%s', %d, '%s address', %d, %d.1);%n",
//					a,i=i+10,a,i,i);
		}
	}
	
	@Test public void test03(){
		String currCellid = "r13_size_1";
		assertFalse("11!",   rs("r13_size_1"));
		assertTrue("22!",    rs("r13_size_1_5"));
		assertTrue("wrong!", rs("r13_size_11"));
		assertTrue("wrong2!", rs("r13_size_111"));
	}
	
	private boolean rs(String currCellid){
		String s1 = "_size_1";
//		String s2 = "_size_1_";
		boolean b ;//= currCellid.indexOf(s2) > -1 || currCellid.indexOf(s1) == -1; 
		b = ( currCellid.indexOf(s1) > -1 && !currCellid.endsWith(s1) ) || currCellid.indexOf(s1) == -1;
		b = ( currCellid.indexOf(s1) > -1 && ((currCellid.indexOf(s1) + s1.length()) != currCellid.length() )) || currCellid.indexOf(s1) == -1;
		return b;
	}
}
